--[[
	LitePanels

	There is no gui config, this file will contain your panel configuration.
	Copy this file and save as layout.lua for it to begin working. Please use UTF-8 encoding.

	Syntax and examples for profiles is given at the bottom of this document. Most default
	values can be viewed at the top of core.lua.
	
	Generally, you'll want to use quotes around values that are not a number,
	true/false, or a {table} value. Other values, such as a parent frame name, strata, anchor,
	gradient orientation, or color "r g b" strings will require quotes around it.

	If you don't understand an attribute below, refer to the wowwiki link.
	
	=== Frame Attributes ===
	attribute [default value] http://reference-link
		Description.
				
	name [number in order created]
		Specifiy a name for your panel, this is useful for scripting or if you want to use
		it as a parent frame. Anonymous panels will be given a number by the order they're 
		listed in the profile. If you need to reference to a panel's name, the name will be 
		prefixed with 'LP_'. Ex: LP_GreenFrame or LP_1
	
	parent ["UIParent"]
		The frame you want to anchor this panel to. Panels will
		inheirit the scale and visibility (not alpha) of the parent.
	
	anchor_frame [parent]
		Sets the panel anchor frame if you'd like to anchor a panel to a frame other than 
		parent while keeping parent's visibility, scale, alpha, etc. Defaults to parent.
		
	anchor_to ["BOTTOMLEFT"] http://www.wowwiki.com/Widget_Anchor_Points
		Which side of the parent to anchor to.
	
	anchor_from [anchor_to *or* "BOTTOMLEFT"] http://www.wowwiki.com/Widget_Anchor_Points
		Which side of the panel to justify the anchor.

	require
		Require an addon to be loaded before showing this panel. Ex: {require="Dominos"},
		This does work with LoadOnDemand addons.

	x_off [0] http://www.wowwiki.com/API_Region_SetPoint
		Number of pixels along the x-axis. Negative moves panel left, positive moves it right.

	y_off [0] http://www.wowwiki.com/API_Region_SetPoint
		Number of pixels along the y-axis. Negative moves panel down, positive moves it up.

	strata ["BACKGROUND"] http://www.wowwiki.com/UITYPE_FrameStrata
		UI strata level you want to place your panel.

	level [1] http://www.wowwiki.com/FrameLevel
		This is a z-index level within the strata. If there's two panels with the same
		strata, a higher level will determine if a panel is shown overlapping the other.
		level can be set to 0 (zero) to place it behind its parent frame.

	width [0] http://www.wowwiki.com/API_Region_SetWidth
		Width of your panel in pixels or a percent. Ex: {width=110,} or {width="100%",}
		If anchor_frame is set, percents will use its width instead of the parent.
		
	height [0] http://www.wowwiki.com/API_Region_SetHeight
		Height of your panel in pixels or a percent. Ex: {height=50,} or {height="60%",}
		If anchor_frame is set, percents will use its height instead of the parent.
	
	bg_color ["0 0 0"] http://www.wowwiki.com/API_Texture_SetTexture
		Background color of the panel set as "r g b" or "CLASS" for class coloring.
		Number value must be between 0 and 1, numbers between must be expressed as a decimal.
		Ex: bg_color = "0 0.4 0.85",

		* The background object will be named `LP_name.bg` if you want to use it in a script.
		* If there is a background image, this value will be the image's vertex color.
		
	bg_alpha [1.0] http://www.wowwiki.com/API_UIObject_SetAlpha
		Opacity of the background color or texture represented as a decimal (0-1), 
		0 being completely transparent, and 1 being completely opaque.

	inset [0 or 1/4 of border_size]
		Number in pixels to indent the background. If negative, it will extend the background,
		creating a padding effect. Will try to automatically adjust itself when a border is set.
		Ex1: inset = -5 -- (same as inset={top=-5,bottom=-5,left=-5,right=-5})
		Ex2: inset = {top=5,bottom=5} -- (same as inset={top=5,bottom=5,left=0,right=0})	

	border [false] http://www.wowwiki.com/API_Frame_SetBackdrop
		This will set path to the border texture file. It can either be set to true to use
		the default ("Interface/Tooltips/UI-Tooltip-Border") or to the file of a different one.
		Ex1: border = true -- Uses default border texture.
		Ex2: border = "texture" -- If texture.tga is in the 'LitePanels/media/' folder.
		Ex3: border = "Interface\\AddOns\\SharedMedia\\border\\roth" -- For files elsewhere.
		Ex4: border = "SOLID" -- Creates a solid border, pixel size determined by border_size
		
	border_size [16] http://www.wowwiki.com/API_Frame_SetBackdrop
		Pixel size of edgeFile, i.e. border thickness and corner size.
		
	border_color ["1 1 1"] http://www.wowwiki.com/API_SetBackdropBorderColor
		Sets the color of the border as "red green blue", can be set to "CLASS" as well.
		Ex1: border_color = "0.5 0.1 1.0"
		Ex2: border_color = "CLASS"

	border_alpha [1.0] http://www.wowwiki.com/API_SetBackdropBorderColor
		Opacity of the border color. 1.0 = completely visible, 0.0 = completely transparent.
	
	gradient
		Gradient orientation of your background. May be represented as "H" (horizontal) or "V" (vertical).
		Ex1: gradient = "H"
		Ex2: gradient = "HORIZONTAL" -- Both work the same.
	
	gradient_color ["1 1 1"]
		Gradient color. First color will be bg_color, this will be the second color.
		See: bg_color

	gradient_alpha [1.0 or bg_alpha] http://www.wowwiki.com/API_UIObject_SetAlpha
		Opacity of the gradient background color. This value is separate from bg_alpha.
		See: bg_alpha
	
	bg_blend http://www.wowwiki.com/AlphaMode
		Alpha blending mode, see wowwiki doc.
	
	tex_file ["Interface\\AddOns\\LitePanels\\media\\**tex_file**"]
		Filename of your texture if you choose to use one. Width and height of the
		image itself must be in powers of two (8,16,32,64,128,256,512)
		If you put the files into the media folder inside the addon's folder, you can
		set this to the filename only, otherwise you must give the whole path.

	tex_coord http://www.wowwiki.com/API_Texture_SetTexCoord
		Advanced, see wowwiki doc.
		Ex: {left,right,top,bottom} or {ULx,ULy,LLx,LLy,URx,URy,LRx,LRy}

	tex_rotate [0]
		Number in degrees you'd like to rotate the texture. (0-360)

	flip_h and flip_v [false]
		If flip_h or flip_v is set to true, the texture will be mirrored
		horizontally or vertically. Ex: {flip_v=true,},

	mouse [false]
		Intercept mouse clicks on this frame; no clicking through.
		This is automatically set to true when using OnClick, OnMouseDown, OnMouseUp,
		OnDoubleClick, OnEnter, or OnLeave scripts.
	
	=== Texts ===
	To create text objects inside of an existing panel, use the following syntax:
	
	{ name = "SomePanel",
	  text = {
	    { attribute = value, attribute2 = value }, -- text object
	    { attribute = value, attribute2 = value }, -- another text object
	  },
	}
	
	* As you can see, you can create as many text objects per panel as you require. If you 
	only need one text object in your panel, you don't need to contain the attributes in 
	an extra curly brace pair like shown above. For example, this syntax would be
	perfectly fine for a single text object: `text = { attribute = value }`
	
	* When you create a single text, the text object will be named `panel.text`. If multiple
	texts are created, they'll be named text1,text2,text3,... in the order they're created.
	
	* A quick text object can be created with default formatting by using `text = "string"` as
	a normal frame attribute.
	
	* If there's a single text object, the frame's default height and width will be set to the
	text object's height and width.
	
	=== Texts Attributes ===
	string [""]
		The main text that will be displayed. This can also be a function with a return value 
		and will, by default, update every 1 second if created as one. This behavior is created 
		as a convenience so you will not need to create an OnUpdate script with a throttle.
		Ex: string = "Buffs"
		Ex: string = function(self)
			  self.tick = self.tick and self.tick + 1 or 0
			  return self.tick
			end
		
	update [1]
		This will only be needed if string is a function. This value is in seconds, and can also be
		a decimal. Ex: update = 0.1 (1/10 second)
		
	font ["Fonts/FRIZQT__.TTF"] http://www.wowwiki.com/API_FontInstance_SetFont
		Path to the font you want to use. Fonts placed in LitePanel's media folder can be used 
		by supplying only its filename.
		Ex1: font = "font.ttf" -- if in the 'LitePanels\media\' folder
		Ex2: font = "Interface\\AddOns\\SharedMedia\\fonts\\ABF.ttf" -- if file is elsewhere
		
	size [12] http://www.wowwiki.com/API_FontInstance_SetFont
		Font size of your text.
	
	color [{1,1,1}] http://www.wowwiki.com/API_FontInstance_SetTextColor
		Set the color of your text.
	
	alpha [1.0] http://www.wowwiki.com/API_FontInstance_SetTextColor
		Transparency of the text from 0.0-1.0. 0.0 is completely transparent, 1.0 is solid.
	
	outline [0] http://www.wowwiki.com/API_FontInstance_SetFont
		Sets the outline flag for the text. 1 for a thin outline, 2 for a thick outline.
		Setting an outline will automatically set the default value for shadow to zero.
	
	shadow [1] 
		Set the distance of the shadow in pixels from the text. Ex: `shadow = 1`
		The default shadow slope is: x = -y
		If you require more control over the shadow appearance,
		use `shadow = { attribute = value }` with the below attributes.
		:	x [1] 
		:		x-offset of the shadow on your text.
		:	y [-1]
		:		y-offset of the shadow on your text.
		:	color ["0 0 0"]
		:		Sets the color of the text's shadow.
		:	alpha [1]
		:		Sets the alpha of the text's shadow.
	
	mono [false] http://www.wowwiki.com/API_FontInstance_SetFont
		Set to true to enable the monochrome flag for the text.
	
	anchor_to ["CENTER"] http://www.wowwiki.com/API_Region_SetPoint
		Which side of the panel to anchor to.
	
	anchor_from ["CENTER"] http://www.wowwiki.com/API_Region_SetPoint
		Which side of the panel to justify the anchor.
	
	x_off [0] http://www.wowwiki.com/API_Region_SetPoint
		Number of pixels along the y-axis. Negative moves panel down, positive moves it up.
	
	y_off [0] http://www.wowwiki.com/API_Region_SetPoint
		Number of pixels along the x-axis. Negative moves panel left, positive moves it right.
		
	justify_h ["CENTER"]
		Sets horizontal text justification ("LEFT","RIGHT", or "CENTER") 
	
	justify_v ["MIDDLE"]
		Sets vertical text justification ("TOP","BOTTOM", or "MIDDLE") 
	
	=== Class Coloring ===
	All color attributes can be class colored fairly easily. Instead of inserting
	a color the standard "r g b", you would use "CLASS".
	Ex: bg_color = "CLASS", gradient_color = "CLASS", border_color = "CLASS"
	
	For a complete list of class colors and their actual color values
	see http://www.wowwiki.com/Class_colors
	
	=== Advanced: Script Attributes ===
	Script attributes are created the same way as regular attributes, except they must
	be assigned a function to be used for that event. 
	
	Currently supported handlers:
		OnClick, OnDoubleClick, OnMouseUp, OnMouseDown, OnEnter, OnLeave, OnUpdate,
		OnResize, OnLoad, OnEvent, OnHide, OnShow
	
	* Refer to wowwiki for details on these handlers. http://www.wowwiki.com/Widget_handlers
	
	* When using an OnUpdate script, you may use the predefined variable `self.elapsed` in a throttle:
	OnUpdate = function(self, u)
	  self.elapsed = self.elapsed + u
	  if elapsed > 3.0 then
	    -- code to run every 3 seconds
	    self.elapsed = 0
	  end
	end
	
	* If you need to define variables for multiple handlers, it may be best to use self.var_name
	and define it in your OnLoad handler:
	OnLoad = function(self)
	  self.clicks = 0
	end,
	OnClick = function(self, button)
	  self.clicks = self.clicks + 1
	  print(self.clicks, button)
	end
	
	-------------------------------------------------------------
	 Edit this layout, save, and type "/reload" to see your changes.

	 Read the above documentation fully before seeking support.
	------------------------------------------------------------- 
]]

------------------------------------------------------------------------------------------
-- API: lpanels:CreateLayout("Layout Name", { _layout code_ }, { _viewport_ })
--	» arg1 - Layout name. Name can be anything at all.
--	» arg2 - Table or reference with your layout code.
--	» arg3 - Viewport table (optional). ie: {top=10, bottom=100, left=5, right=5} or {bottom=100}

lpanels:CreateLayout("Load For All", {
	-- Create a global layout right here
	
})

--------------------------------------------------
-- Example layout, you may modify or delete it. --
--------------------------------------------------
lpanels:CreateLayout("Simple Viewport", {
	-- Main viewport background
	{	name = "GreyBox",
		strata = "BACKGROUND", level = 0,
		x_off = 0, y_off = 0,
		width = "100%", height = 125,
		bg_color = "0.1 0.1 0.1", bg_alpha = 1,
		text = {
			string = "Your Viewport, Sir!",
			size = 10, outline = 1,
		},
	},
	-- A class colored border anchored to the top of the viewport
	{	name = "TopBorder", parent = "GreyBox", 
		anchor_to = "TOP", y_off = 1,
		width = "100%", height = 1,
		bg_color = "CLASS", bg_alpha = 0.5,
	},
}, { bottom = 125 }) -- Optional viewport config

lpanels:CreateLayout("Chat Background", {
	-- Background for chat on left side
	{	name = "Chat", parent = "GreyBox",
		width = 300, height = "100%",
		bg_color = "0 0 0", 
	},
	-- Background for combat log on right side
	{	name = "Combatlog", parent = "GreyBox", 
		anchor_to = "BOTTOMRIGHT",
		width = 300, height = "100%",
		bg_color = "0 0 0", 
	},
	-- Line on the right side of the chat box
	{	name = "ChatBorder", parent = "Chat",
		anchor_to = "RIGHT",
		width = 1, height = "100%",
		bg_color = "CLASS", bg_alpha = 0.5,
	},	
	-- Line on the left side of the combat log box
	{	name = "CombatlogBorder", parent = "Combatlog",
		anchor_to = "LEFT",
		width = 1, height = "100%",
		bg_color = "CLASS", bg_alpha = 0.5,
	},
})

------------------------------------------------------------------------------------------
-- API: lpanels:ApplyLayout("n:Character r:Realm c:Class", "layout1", "layout2", "layout3")
--  » arg1 - Profile string: May be set to any combination of n:ame, r:ealm, c:lass, 
--		separated by a single space. If nil, applies the specified layouts to all
--		characters. Additionally, a dash may be applied to front of the
--		condition (-n:ame -r:ealm -c:lass) to make the layout NOT load on the specified
--		value. The profile string is *not* case-sensitive. Realm names with spaces must
--		have their spaces stripped out.
--	» arg2,... - Layout names created by CreateLayout() to apply to this profile. No set
--      limit to how many layouts can be applied per profile.

lpanels:ApplyLayout(nil, "Load For All")
lpanels:ApplyLayout("n:batman", "Simple Viewport", "Chat Background")

--[[
	--- More profile examples ---
	[1] Load a layout named 'priesty' on all priests except for ones named Holynovaz:
		lpanels:ApplyLayout("c:priest -n:holynovaz", "priesty")

	[2] Load 'not warrior' on all classes except for Warriors:
		lpanels:ApplyLayout("-c:warrior", "not warrior")

	[3] Load both 'layout1' and 'layout2' on all characters on the realms Blackwing Lair and
		Mal'Ghanis, or characters named Ohhai on any realm:
		lpanels:ApplyLayout("r:blackwinglair r:mal'ghanis n:ohhai", "layout1", "layout2")

	[4] Load 'bars' and 'minimap' for all Hyjal shamans or characters named Lolcoil on any server:
		ApplyLayout("n:lolcoil (r:hyjal c:shaman)", "bars", "minimap")
		
	[5] Load 'overlay1' and 'overlay2' on characters named Huntz on realm Anvilmar and all warriors:
		lpanels:ApplyLayout("(n:huntz r:anvilmar) c:warrior", "overlay1", "overlay2")
]]

